import {defineStore} from 'pinia'

interface UserForLogIn {
        userId:number,
        username:string,
        password:string,
        verifyCode:string,
        captchaId:string,
        token:string,
        imgPath:string
    }
export const useUserStore = defineStore('user', {
    state: ()=> ({
        userId: 0,
        username:'',
        imgPath:'',
        token:''
    }),
    getters: {
    },
    actions: {
        logIn(userInfo: UserForLogIn) {
            console.log("pinia user状态更新");
            this.userId = userInfo.userId;
            this.username = userInfo.username;
            this.imgPath = userInfo.imgPath;
            this.token = userInfo.token;
            console.log(this.imgPath);
            
        }
    }
})